package net.kazed.nextaction.menu;

import net.kazed.android.inject.Autowired;
import net.kazed.nextaction.R;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.view.Menu;

public class MenuFactory {

   private Context context;
   
   private int nextMenuId = Menu.FIRST;

   @Autowired
   public void setContext(Context context) {
      this.context = context;
   }
   
   public void addTimerMenu(Menu menu, int menuId) {
   }

   public OptionMenuItem addTimerMenu(Activity activity, Menu menu) {
      int menuId = nextMenuId;
      nextMenuId++;
      menu.add(0, menuId, 0, R.string.menu_timer)
         .setIcon(R.drawable.menu_timer).setAlphabeticShortcut('t');
      return new TimerMenuItem(context, activity, menuId);
   }
   
   private static class TimerMenuItem implements OptionMenuItem {

      private final int menuId;
      private final Activity activity;
      private final Context context;

      public TimerMenuItem(Context context, Activity activity, int menuId) {
         this.context = context;
         this.activity = activity;
         this.menuId = menuId;
      }

      @Override
      public boolean isMenu(int receivedItemId) {
         return menuId == receivedItemId;
      }

      @Override
      public void onSelected() {
//         Intent intent = new Intent(context, );
//         activity.startActivity(intent);
      }
   }
}
